package so.wy.servicecenter.businessbed.service.deposit;

import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.Date;
import com.alibaba.fastjson.annotation.JSONField;
import so.wy.servicecenter.businessbed.dao.rdb.deposit.DepositDO;

/**
* @author wdl
* @date 2020-04-26
*/
@Data
@NoArgsConstructor
public class DepositDTO{

	/** 主键ID */
	private Long id;
	/** 押金状态 */
	private Integer isOpen;
	private BigDecimal depositAmount;
	@JSONField(format="yyyy-MM-dd HH:mm:ss")
	private Date depositTime;
	/** 押金备注 */
	private String depositRemark;
	/** 排序 */
	private Integer sortNum;

	public DepositDTO(DepositDO depositDO){
		if(depositDO==null){
			return ;
		}

		this.id = depositDO.getId();
		this.isOpen = depositDO.getIsOpen();
		this.depositAmount = depositDO.getDepositAmount();
		this.depositTime = depositDO.getDepositTime();
		this.depositRemark = depositDO.getDepositRemark();
		this.sortNum = depositDO.getSortNum();
	}

	public DepositDO convert2DO(){
		DepositDO depositDO = new DepositDO();
		depositDO.setId(this.id);
		depositDO.setIsOpen(this.isOpen);
		depositDO.setDepositAmount(this.depositAmount);
		depositDO.setDepositTime(this.depositTime);
		depositDO.setDepositRemark(this.depositRemark);
		depositDO.setSortNum(this.sortNum);
		return depositDO;
	}

}
